package com.woniu40.separate_music.web;

import com.woniu40.separate_music.entity.MusicType;
import com.woniu40.separate_music.result.ResponseResult;
import com.woniu40.separate_music.service.MusicTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@RequestMapping("type")
@CrossOrigin
public class MusiCtTypeController {

    @Autowired
    MusicTypeService musicTypeService;

    @GetMapping("/typeList")
    public ResponseResult<List<MusicType>> show(){
        List<MusicType> typeAll = musicTypeService.findTypeAll();
        ResponseResult<List<MusicType>> result = new ResponseResult<>();
        result.setCode(200);
        result.setMessage("查询成功!!!");
        result.setData(typeAll);
        return result;
    }
}
